<!--  -->
<template>
  <div v-color="color">自定义指令
  </div>

<MyCom :sendHandle="sendHandle" ref="refCom"></MyCom>

<button @click="send">给子组件传值</button>
   


  <input type="text" v-focus >
</template>

<script lang='ts' setup>
import MyCom from './MyCom.vue';
import { reactive,toRefs,ref,onMounted} from 'vue'


 
const color=ref('blue');

const refCom=ref();

const sendHandle=(val:string)=>{

  alert("接收到子组件传过来的数据"+val);
 
}

const send=()=>{
  refCom.value.msg='来自父组件'

  refCom.value.say();
}

const vFocus={
    mounted(el:any){

        
        el.focus()
    }
}



 

</script>
<style scoped>
</style>